package com.yuju.login.enums;
/**
 * 
 * 类名：RoleReturnCodeEnum  <br />
 *
 * 功能：
 *
 * @author : zhousc <br />
 * @Date : 2017年12月4日 上午10:40:04  <br />
 * @version : 1.1 <br />
 */
public enum RoleReturnCodeEnum {
	ROLE_QUERY_SUCCESS("yuju-role-1000", "角色查询成功"),
	ROLE_QUERY_FAILURE("yuju-role-1001", "角色查询失败"),
	ROLE_SAVE_SUCCESS("yuju-role-1002", "角色保存成功"),
	ROLE_SAVE_FAILURE("yuju-role-1003", "角色保存失败"),
	ROLE_UPDATE_SUCCESS("yuju-role-1004", "角色更新成功"),
	ROLE_UPDATE_FAILURE("yuju-role-1005", "角色更新失败"),
	ROLE_DEL_SUCCESS("yuju-role-1006", "角色删除成功"),
	ROLE_DEL_FAILURE("yuju-role-1007", "角色删除失败"),
	ROLE_VALID_SUCCESS("yuju-role-1008", "验证成功"),
	ROLE_VALID_FAILURE("yuju-role-1009", "验证失败"),
	ROLE_DEL_FAILURE_BY_OP("yuju-role-1010", "该角色已有账号，不可删除");
	
	private String code;
	private String desc;
	
	RoleReturnCodeEnum(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	public static String getDescByCode(String code) {
		for (RoleReturnCodeEnum enume : RoleReturnCodeEnum.values()) {
			if (enume.getCode().equals(code)) {
				return enume.getDesc();
			}
		}
		
		return "未知枚举类型";
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
}